home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Zoom 2
/
Zoom - Release 2 (1996)(Active Software)[!].iso
/
texts
/
amoszine
/
arts
/
tl_arrays.asc
< prev
Wrap
Text File
|
1992-09-02
|
2KB
|
46 lines
@2{ARRAYS IN AMOS
@3
}Thomas Lancaster
@4
You probably all know how to use arrays in AMOS. If not you`re missing
out on a treat that is needed to fully appreciate the programming
language.
@3
An array is a storage area in the computer`s memory. Just like a
variable it is given a name, but it is also given a size. Because of
this it is important to set it up before it can be used.
@5
To do this use the command:
@1
Dim ARRAY(N) -where ARRAY is the name of the array
N is the size of the array.
@4
The array name follows the standard format of variables in AMOS, eg
NUMBERS for numeric data or LETTER$ for words. The command creates a
series of boxes numbered from 0 to N that can each be written to in the
same way as any other variable (provided the number part or element of
the array is specified).
@4 Each element will initially be blank, that`s the equivalent of 0 in a
numerical array or "" in any other.
@3
For example try this program to create an array in AMOS and fill it from
random numbers.
@1
Dim NUMBERS(10)
For COUNTER=0 To 10
NUMBERS(COUNTER)=Rnd(9)+1
Next COUNTER
@5
This is the equivalent of creating 11 variables and filling them with a
number from 1 to 10. As I`m sure you`ll appreciate this is a much more
efficient method and has the advantage that it is much easier to call up
a particular value. Arrays have major uses in any of today`s games or
application programs.
@6
Thomas Lancaster